package com.example.basicdemo.test;

import com.isyscore.os.pivot.client.audit.PivotAudit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
@Slf4j
public class StartTask {

    @PostConstruct
    public void builder() {
        init();
    }

    public void init() throws RuntimeException {
//        new R.execute(() -> log());
    }

    private PivotAudit pivotAudit = PivotAudit.getInstance();

    private void log() {
        int i = 0;
        while (true) {
            try {
                log.debug("持续产生debug日志----" + i);
                log.info("持续产生info日志----" + i);
                log.warn("持续产生warn日志----" + i);
                log.error("持续产生error日志----" + i);
                pivotAudit.log("basic-demo.log", "新增", "用户", "测试" + i++);
                //5s 记录一次
                Thread.sleep(5000);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

}
